function checkSearchWord() {
	var boolean = $("#inp").val() == '' ? false : true;
	if (!boolean) {
		$(".alert").show();
	}
	return boolean;
}
function closeAlert(){
	$(".alert").hide();
}



avalon.filters.topInputYyrkRender=function(obj){
	var htmlStr="";
	obj.STITLE=obj.STITLE.replace(topSearchVm.searchData.p+'','<span>'+topSearchVm.searchData.p+'</span>');
	htmlStr+='<a href="'+obj.DOCPUBURL+'"  target="_blank">'+obj.STITLE+'</a>';
	return htmlStr;
}

avalon.filters.topInputZxzxRender=function(obj){
	if(obj.TITLE.length>22){
		obj.TITLE=obj.TITLE.substring(0,19)+'...';
	}
	var title=obj.TITLE.replace(topSearchVm.searchData.p+'','<span>'+topSearchVm.searchData.p+'</span>');
	var htmlStr="";
	htmlStr+='<a target="_blank" href="'+obj.DOCPUBURL+'" title="'+obj.TITLE+'" target="_blank"  >'+title+'</a>';
	return htmlStr;
}
var topSearchVm=avalon.define({
	$id:'topSearchInput',
	AjaxUrl:'https://www.ixm.gov.cn/gateway/api/ixm/search/query.jhtml',
	searchData:{
		p:'',
		yyzx:{
			pageNo:1,
			pageSize:3
		},
		zxzx:{
			pageNo:1,
			pageSize:5
		}
	},
	data:{
		yyzx:{},
		zxzx:{}
	},
	getObjStr:function(obj){
		return JSON.stringify(obj);
	},
	baseEncode: function(obj) {
		var paramsStr = topSearchVm.getObjStr(obj);
		var base64Str = encodeURIComponent(new Base().encode(paramsStr));
		return base64Str;
	},
	AjaxData: function(obj, callBack) {
		var baseParam = topSearchVm.baseEncode(obj);
		$.ajax({
			url: topSearchVm.AjaxUrl,
			dataType: 'json',
			method: 'Post',
			data: {
				p: baseParam
			},
			success: function(msg) {
				callBack(msg);
			},
			error: function(errMsg) {
				avalon.log("错误信息--------------");
				avalon.log(errMsg);
			}
		})
	},
	initData: function() {
		topSearchVm.AjaxData(topSearchVm.searchData, function(msg) {
			if (msg.result) {
				avalon.log(msg);
				topSearchVm.data.yyzx=msg.data.yyzx;
				topSearchVm.data.zxzx=msg.data.zxzx;
			}
		})
	},
	inputFocus:function(){
		if(topSearchVm.searchData.p!=''){
			$(".ss_con1").slideDown();
		}
	}
})
topSearchVm.$watch('searchData.p',function(n,o){
	if(n!=''){
		topSearchVm.initData();
		$(".ss_con1").slideDown();
	}
	if(n==''){
		$(".ss_con1").slideUp();
	}
})
$.ajax({
	url:'https://www.ixm.gov.cn/fw/search/data.jsonp',
	dataType:'jsonp',
	jsonpCallback:'pushInfoJsonpCallBack',
	success:function(msg){
		var htmlStr="";
		$.each(msg,function(index,data){
			htmlStr+='<a href="'+msg[index].url+'" title="'+msg[index].title+'">'+msg[index].title+'</a>';
		})
		$("#rs_con").append(htmlStr);
	}
})